home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ham Radio 2000
/
Ham Radio 2000.iso
/
ham2000
/
misc
/
dspice0s
/
evpoly.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-11-21
|
5KB
|
185 lines
/* evpoly.f -- translated by f2c (version of 3 February 1990 3:36:42).
You must link the resulting object file with the libraries:
-lF77 -lI77 -lm -lc (in that order)
*/
#include "f2c.h"
/* Common Block Declarations */
struct {
doublereal value[200000];
} blank_;
#define blank_1 blank_
/*< subroutine evpoly(result,itype,lcoef,ncoef,larg, >*/
/*< 1 narg,lexp) >*/
/* Subroutine */ int evpoly_(result, itype, lcoef, ncoef, larg, narg, lexp)
doublereal *result;
integer *itype, *lcoef, *ncoef, *larg, *narg, *lexp;
{
/* System generated locals */
integer i_1, i_2, i_3;
/* Local variables */
extern /* Subroutine */ int zero4_();
static integer i, j;
#define nodplc ((integer *)&blank_1)
#define cvalue ((complex *)&blank_1)
extern /* Subroutine */ int evterm_(), nxtpwr_();
static doublereal arg, val, arg1;
/*< implicit double precision (a-h,o-z) >*/
/* this routine evaluates a polynomial. lcoef points to the coef- */
/* ficients, and larg points to the values of the polynomial argument(s).
*/
/* spice version 2g.6 sccsid=blank 3/15/83 */
/*< common /blank/ value(200000) >*/
/*< integer nodplc(64) >*/
/*< complex cvalue(32) >*/
/*< equivalence (value(1),nodplc(1),cvalue(1)) >*/
/*< if (itype) 100,200,300 >*/
if (*itype < 0) {
goto L100;
} else if (*itype == 0) {
goto L200;
} else {
goto L300;
}
/* integration (polynomial *must* be one-dimensional) */
/*< 100 result=0.0d0 >*/
L100:
*result = 0.;
/*< arg=1.0d0 >*/
arg = 1.;
/*< arg1=value(larg+1) >*/
arg1 = blank_1.value[*larg];
/*< do 110 i=1,ncoef >*/
i_1 = *ncoef;
for (i = 1; i <= i_1; ++i) {
/*< arg=arg*arg1 >*/
arg *= arg1;
/*< result=result+value(lcoef+i)*arg/dble(i) >*/
*result += blank_1.value[*lcoef + i - 1] * arg / (doublereal) i;
/*< 110 continue >*/
/* L110: */
}
/*< go to 1000 >*/
goto L1000;
/* evaluation of the polynomial */
/*< 200 result=value(lcoef+1) >*/
L200:
*result = blank_1.value[*lcoef];
/*< if (ncoef.eq.1) go to 1000 >*/
if (*ncoef == 1) {
goto L1000;
}
/*< call zero4(nodplc(lexp+1),narg) >*/
zero4_(&nodplc[*lexp], narg);
/*< do 220 i=2,ncoef >*/
i_1 = *ncoef;
for (i = 2; i <= i_1; ++i) {
/*< call nxtpwr(nodplc(lexp+1),narg) >*/
nxtpwr_(&nodplc[*lexp], narg);
/*< if (value(lcoef+i).eq.0.0d0) go to 220 >*/
if (blank_1.value[*lcoef + i - 1] == 0.) {
goto L220;
}
/*< arg=1.0d0 >*/
arg = 1.;
/*< do 210 j=1,narg >*/
i_2 = *narg;
for (j = 1; j <= i_2; ++j) {
/*< call evterm(val,value(larg+j),nodplc(lexp+j)) >*/
evterm_(&val, &blank_1.value[*larg + j - 1], &nodplc[*lexp + j -
1]);
/*< arg=arg*val >*/
arg *= val;
/*< 210 continue >*/
/* L210: */
}
/*< result=result+value(lcoef+i)*arg >*/
*result += blank_1.value[*lcoef + i - 1] * arg;
/*< 220 continue >*/
L220:
;}
/*< go to 1000 >*/
goto L1000;
/* partial derivative with respect to the itype*th variable */
/*< 300 result=0.0d0 >*/
L300:
*result = 0.;
/*< if (ncoef.eq.1) go to 1000 >*/
if (*ncoef == 1) {
goto L1000;
}
/*< call zero4(nodplc(lexp+1),narg) >*/
zero4_(&nodplc[*lexp], narg);
/*< do 330 i=2,ncoef >*/
i_1 = *ncoef;
for (i = 2; i <= i_1; ++i) {
/*< call nxtpwr(nodplc(lexp+1),narg) >*/
nxtpwr_(&nodplc[*lexp], narg);
/*< if (nodplc(lexp+itype).eq.0) go to 330 >*/
if (nodplc[*lexp + *itype - 1] == 0) {
goto L330;
}
/*< if (value(lcoef+i).eq.0.0d0) go to 330 >*/
if (blank_1.value[*lcoef + i - 1] == 0.) {
goto L330;
}
/*< arg=1.0d0 >*/
arg = 1.;
/*< do 320 j=1,narg >*/
i_2 = *narg;
for (j = 1; j <= i_2; ++j) {
/*< if (j.eq.itype) go to 310 >*/
if (j == *itype) {
goto L310;
}
/*< call evterm(val,value(larg+j),nodplc(lexp+j)) >*/
evterm_(&val, &blank_1.value[*larg + j - 1], &nodplc[*lexp + j -
1]);
/*< arg=arg*val >*/
arg *= val;
/*< go to 320 >*/
goto L320;
/*< 310 call evterm(val,value(larg+j),nodplc(lexp+j)-1) >*/
L310:
i_3 = nodplc[*lexp + j - 1] - 1;
evterm_(&val, &blank_1.value[*larg + j - 1], &i_3);
/*< arg=arg*dble(nodplc(lexp+j))*val >*/
arg = arg * (doublereal) nodplc[*lexp + j - 1] * val;
/*< 320 continue >*/
L320:
;}
/*< result=result+value(lcoef+i)*arg >*/
*result += blank_1.value[*lcoef + i - 1] * arg;
/*< 330 continue >*/
L330:
;}
/* finished */
/*< 1000 return >*/
L1000:
return 0;
/*< end >*/
} /* evpoly_ */
#undef cvalue
#undef nodplc